package com.a214.yxz.yuejian013.Activity;

import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.a214.yxz.yuejian013.Base.BaseSActivity;
import com.a214.yxz.yuejian013.JavaBean.AboutUsBean;
import com.a214.yxz.yuejian013.Listener.ServiceListener;
import com.a214.yxz.yuejian013.Model.ResModel;
import com.a214.yxz.yuejian013.R;
import com.squareup.picasso.Picasso;

public class AboutUsActivity extends BaseSActivity {
    private TextView corpname,contact;
    private ImageView logo;
    private ServiceListener<AboutUsBean> listener;
    private ResModel model=new ResModel("gson",getSessionID());

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about_us);

        corpname= (TextView) findViewById(R.id.user_about_us_corpname);
        contact= (TextView) findViewById(R.id.user_about_us_contact);
        logo= (ImageView) findViewById(R.id.user_about_us_logo);
        listener = new ServiceListener<AboutUsBean>() {
            @Override
            public void onResponse(AboutUsBean l) {
                corpname.setText(l.getCorpname());
                contact.setText(l.getContact());
                logo.setImageBitmap(BitmapFactory.decodeResource(AboutUsActivity.this.getResources(), R.drawable.user));
                Picasso.with(AboutUsActivity.this)
                        .load("http://172.24.10.175/workout/Uploads/" + l.getLogo())
                        .placeholder(R.drawable.user)
                        .into(logo);
            }

            @Override
            public void onFail(String msg) {
                Toast.makeText(AboutUsActivity.this, msg, Toast.LENGTH_SHORT).show();
            }
        };

        model.aboutUs(listener);
    }
}
